This one will start its own terminal, but only if it's not in a terminal already.

#~ if [ ! -t 0 ]; then # script is executed outside the terminal?
  #~ # execute the script inside a terminal window
  #~ TILESET=true urxvt -e "$0"
  #~ # and abort running the rest of it
  #~ exit 0
#~ fi

#~ [[ "x$TILESET" == "x" ]] && echo "Do not run this script inside an existing terminal window.
#~ You will aslo need one of the supported terminal emulators:
#~ ${terms[@]}
#~ " && exit 1

###############################################################################

other ways of resizing the terminal & retrieving its size in pixels

#~ printf "\x1B[8;24;80t" # resize terminal to standard 80x24
# invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Functions-using-CSI-_-ordered-by-the-final-character_s_
#~ wmctrl -b add,maximized_vert -ir $WINDOWID # maximize vertically

#~ oldifs="$IFS"
#~ IFS=$'\n'
#~ array=( $(xwininfo -id $WINDOWID -wm -stats | grep -oE 'Width: .*|Height: .*|Frame extents: .*') )
#~ IFS="$oldifs"
#~ unset oldifs
#~ width="${array[0]##*: }"
#~ height="${array[1]##*: }"
#~ array[2]="${array[2]##*: }"
#~ frameheight="${array[2]##*, }"
#~ array[2]="${array[2]%, *}"
#~ frameheight=$(( frameheight + ${array[2]##*, } ))
#~ array[2]="${array[2]%, *}"
#~ framewidth="${array[2]##*, }"
#~ array[2]="${array[2]%, *}"
#~ framewidth=$(( framewidth + ${array[2]##*, } ))
#~ unset array

###############################################################################

function clear24 { # clears the first 24 lines of terminal and puts the cursor to 0 0
	for (( i=0 ; i<24 ; i++ )); do
		tput cup $i 0
		tput el
	done
	tput cup 0 0
}

###############################################################################


